//
//  HLControl.h
//  WNSDKTools
//
//  Created by 胡林虎 on 16/7/4.
//  Copyright © 2016年 胡林虎. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIControl+Block.h"


@interface HLControl : UIView

#pragma mark - For UIView
+ (UIView *)createUIViewWithFrame:(CGRect)frame
                          bgColor:(UIColor *)bgColor
                              tag:(NSInteger)tag;

+ (UIView *)createUIViewWithFrame:(CGRect)frame
                          bgColor:(UIColor *)bgColor
                     cornerRadius:(CGFloat)cornerRadius
                              tag:(NSInteger)tag;

+ (UIView *)createUIViewWithFrame:(CGRect)frame
                          bgColor:(UIColor *)bgColor
                     cornerRadius:(CGFloat)cornerRadius
                    actionGesture:(UIGestureRecognizer *)gesture
                              tag:(NSInteger)tag;

+ (UIView *)createUIViewWithFrame:(CGRect)frame
                          bgColor:(UIColor *)bgColor
                     cornerRadius:(CGFloat)cornerRadius
                              tag:(NSInteger)tag
                        tapAction:(void(^)())tapAction;



#pragma mark - For UILabel
+ (UILabel *)createLabelWithFrame:(CGRect)frame
                             text:(NSString *)text
                    textAlignment:(NSTextAlignment)textAlignment
                         fontSize:(CGFloat)fontSize
                              tag:(NSInteger)tag;

+ (UILabel *)createLabelWithFrame:(CGRect)frame
                             text:(NSString *)text
                    textAlignment:(NSTextAlignment)textAlignment
                         fontSize:(CGFloat)fontSize
                        textColor:(UIColor *)textColor
                              tag:(NSInteger)tag;

+ (UILabel *)createLabelWithFrame:(CGRect)frame
                             text:(NSString *)text
                    textAlignment:(NSTextAlignment)textAlignment
                         fontSize:(CGFloat)fontSize
                        textColor:(UIColor *)textColor
                          bgColor:(UIColor *)bgColor
                              tag:(NSInteger)tag;

+ (UILabel *)createLabelWithFrame:(CGRect)frame
                             text:(NSString *)text
                    textAlignment:(NSTextAlignment)textAlignment
                         fontSize:(CGFloat)fontSize
                        textColor:(UIColor *)textColor
                          bgColor:(UIColor *)bgColor
                     cornerRadius:(CGFloat)cornerRadius
                              tag:(NSInteger)tag;

+ (UILabel *)createLabelWithFrame:(CGRect)frame
                             text:(NSString *)text
                    textAlignment:(NSTextAlignment)textAlignment
                         fontSize:(CGFloat)fontSize
                        textColor:(UIColor *)textColor
                          bgColor:(UIColor *)bgColor
                     cornerRadius:(CGFloat)cornerRadius
                              tag:(NSInteger)tag
                        tapAction:(void(^)())tapAction;

#pragma mark - For UIButton
+ (UIButton *)createButtonWithFrame:(CGRect)frame
                              title:(NSString *)title
                           fontSize:(CGFloat)fontSize
                          imageName:(NSString *)imageName
                        bgImageName:(NSString *)bgImageName
                                tag:(NSInteger)tag
                             action:(void(^)())action;

+ (UIButton *)createButtonWithFrame:(CGRect)frame
                              title:(NSString *)title
                           fontSize:(CGFloat)fontSize
                         titleColor:(UIColor *)titleColor
                            bgColor:(UIColor *)bgColor
                          imageName:(NSString *)imageName
                        bgImageName:(NSString *)bgImageName
                                tag:(NSInteger)tag
                             action:(void(^)())action;

+ (UIButton *)createButtonWithFrame:(CGRect)frame
                              title:(NSString *)title
                           fontSize:(CGFloat)fontSize
                         titleColor:(UIColor *)titleColor
                            bgColor:(UIColor *)bgColor
                          imageName:(NSString *)imageName
                        bgImageName:(NSString *)bgImageName
                       cornerRadius:(CGFloat)cornerRadius
                                tag:(NSInteger)tag
                             action:(void(^)())action;

#pragma mark - For UIImageView
+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                                imageName:(NSString *)imageName
                                      tag:(NSInteger)tag;


+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag;

+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                                imageName:(NSString *)imageName
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag;

+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                                imageName:(NSString *)imageName
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag
                            actionGesture:(UIGestureRecognizer *)gesture;

+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                                imageName:(NSString *)imageName
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag
                                tapAction:(void(^)())tapAction;

+ (UIImageView *)createImageViewWithFrame:(CGRect)frame
                                imageName:(NSString *)imageName
                              roundCorner:(BOOL)roundCorner
                                      tag:(NSInteger)tag
                                tapAction:(void(^)())tapAction;

#pragma mark - For UITextFeild

+ (UITextField *)createTextFiledWithFrame:(CGRect)frame
                              bgImageName:(NSString *)bgImageName
                              placeholder:(NSString *)placeholder
                                      tag:(NSInteger)tag;

+ (UITextField *)createTextFiledWithFrame:(CGRect)frame
                              bgImageName:(NSString *)bgImageName
                              placeholder:(NSString *)placeholder
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag;

+ (UITextField *)createTextFiledWithFrame:(CGRect)frame
                              bgImageName:(NSString *)bgImageName
                              placeholder:(NSString *)placeholder
                               isPassWord:(BOOL)isPassWord
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag;

+ (UITextField *)createTextFiledWithFrame:(CGRect)frame
                              bgImageName:(NSString *)bgImageName
                              placeholder:(NSString *)placeholder
                               isPassWord:(BOOL)isPassWord
                                 leftView:(UIView *)leftView
                                rightView:(UIView *)rightView
                             cornerRadius:(CGFloat)cornerRadius
                                      tag:(NSInteger)tag;



@end


/**
 *  使用分类方法 初始化 添加手势
 *
 *  @param block 手势回调
 *
 *  @return block 内部 action
 *
 *  使用 __unsafe_unretained __typeof(self) weakSelf = self;
 *  防止循环引用
 *
 */
typedef void(^GestureAction)(id gestureRecognizer);

@interface UIGestureRecognizer (Gesture)

-(instancetype)initWithActionBlock:(GestureAction)gestureAction;

//-(instancetype)initWithActionBlock:(void(^)(id responseObject))gestureAction;

@end









